import time

from selenium import webdriver

from Lib.zcm.common.ui.Selector import Selector
from .menu import Menu


def test_open_menus_antd3x():
    browser = webdriver.Chrome()
    browser.maximize_window()
    # 由于ant页面上的菜单项太多了，无法具体定位到某一菜单，所以使用在codeSandBox中打开
    # 所以测试网址每次都会变
    # browser.get("https://3x.ant.design/components/menu-cn/")
    browser.get("https://oletd.csb.app/")
    try:
        menu = Menu(browser, 'components-menu-demo-horizontal', Selector.ID)
        # 顶部导航
        # menu_titles = ['Navigation Three - Submenu','Option 3'] #OK
        # 内嵌菜单
        # menu_titles = ['Navigation Two', 'Submenu', 'Option 8'] #OK
        # 缩起内嵌菜单
        # menu_titles = ['Navigation Two', 'Submenu', 'Option 12'] #OK
        # 只展开当前父级菜单
        # menu_titles = ['Navigation Three', 'Option 12'] #OK
        # menu_titles = ['Navigation One', 'Option 4']
        # 垂直菜单
        menu_titles = ['Navigation Two', 'Submenu', 'Option 8']
        menu.open_menu(*menu_titles)
        time.sleep(10)
    finally:
        pass
        # browser.close()